<!DOCTYPE html>
{% from 'macro/page.html' import render_pagination %}
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <title>标签库</title>
    <link rel="stylesheet" href="{{ url_for('admins.static', filename='lte/style/css/adminlte.min.css') }}">
    <link rel="stylesheet"
          href="{{ url_for('admins.static', filename='lte/plugins/icheck-bootstrap/icheck-bootstrap.min.css') }}">

    <script>
function send_tag(title){
    const parent_tag = opener.document.getElementById("tags")
    let str, r, v
    str = '，' + parent_tag.value + '，'
    r = str.split('，' + title + '，')
    if(r.length != 1){
        return false
    }
    if(str=='，，'){
        v = ''
    }else{
        v = '，'
    }
    parent_tag.value += v + title
}


    </script>
    <style>
        .t{
            margin:10px;
            display: inline-table;
        }


    </style>
</head>
<body>
<div class="container-fluid">
    <form class="form-inline mt-2">
        <label class="sr-only" for="inlineFormInputGroupUsername2">Username</label>
        <div class="input-group mb-2 mr-sm-2">
            <div class="input-group-prepend">
                <div class="input-group-text">搜索</div>
            </div>
            <input type="text" class="form-control" name="title" placeholder="TAG名称" value="{{ request.args.get('title') or '' }}">
        </div>

        <div class="form-check mb-2 mr-sm-2 icheck-primary">
            <input name="good" class="form-check-input" type="checkbox" id="inlineFormCheck" {%- if request.args.get('good') %} checked {% endif -%}>
            <label class="form-check-label" for="inlineFormCheck">
                推荐TAGS
            </label>
        </div>

        <button type="submit" class="btn btn-primary mb-2">筛选</button>
    </form>
    <div class="card">
        <!-- /.card-header -->
        <div class="card-body">
            {% for item in record.items %}
            <a class="t"
               href="#empirecms" onclick="send_tag('{{ item.tag_name }}');"
               title='TAGID：{{ item.id }}'>{{ item.tag_name }}</a>
            {% endfor %}
        </div>
    </div>
    {{ render_pagination(record) }}
</div>
</body>
</html>